package util;

import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.FileReader;

public class DivideTweets {
	public static void main(String[] args) {
		try {
			BufferedReader todosOsTweets = new BufferedReader(new FileReader("Files/Tweets.txt"));
			FileOutputStream tweets = new FileOutputStream("Files/Tweets1.txt");
			int indice = 1;
			int limite = 200;
			int estado = 0;
			
			String tweet;
		    while ((tweet = todosOsTweets.readLine()) != null) {
		    	if (!tweet.isEmpty()) {
		    		if (estado == limite) {
		    			limite += 200;
		    			indice++;
		    			tweets = new FileOutputStream("Files/Tweets" + indice + ".txt");
		    		}
		    		estado++;
		    		tweets.write((tweet + System.getProperty("line.separator")).getBytes());
		    	}
		    }
		    todosOsTweets.close();
		    tweets.close();
		} catch (Exception ex) {
			System.err.println(ex.getMessage());
		}			
	}
}